{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://www.geeksforgeeks.org/three-dimensional-plotting-in-python-using-matplotlib/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "fig = plt.figure()\n",
    "ax = plt.axes(projection='3d')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# importing mplot3d toolkits, numpy and matplotlib\n",
    "from mpl_toolkits import mplot3d\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "fig = plt.figure()\n",
    "\n",
    "# syntax for 3-D projection\n",
    "ax = plt.axes(projection ='3d')\n",
    "\n",
    "# defining all 3 axis\n",
    "z = np.linspace(0, 1, 100)\n",
    "x = z * np.sin(25 * z)\n",
    "y = z * np.cos(25 * z)\n",
    "\n",
    "# plotting\n",
    "ax.plot3D(x, y, z, 'green')\n",
    "ax.set_title('3D line plot geeks for geeks')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# importing mplot3d toolkits\n",
    "from mpl_toolkits import mplot3d\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "fig = plt.figure()\n",
    "\n",
    "# syntax for 3-D projection\n",
    "ax = plt.axes(projection ='3d')\n",
    "\n",
    "# defining axes\n",
    "z = np.linspace(0, 1, 100)\n",
    "x = z * np.sin(25 * z)\n",
    "y = z * np.cos(25 * z)\n",
    "c = x + y\n",
    "ax.scatter(x, y, z, c = c)\n",
    "\n",
    "# syntax for plotting\n",
    "ax.set_title('3d Scatter plot geeks for geeks')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# importing libraries\n",
    "from mpl_toolkits import mplot3d\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# defining surface and axes\n",
    "x = np.outer(np.linspace(-2, 2, 10), np.ones(10))\n",
    "y = x.copy().T\n",
    "z = np.cos(x ** 2 + y ** 3)\n",
    "\n",
    "fig = plt.figure()\n",
    "\n",
    "# syntax for 3-D plotting\n",
    "ax = plt.axes(projection='3d')\n",
    "\n",
    "# syntax for plotting\n",
    "ax.plot_surface(x, y, z, cmap='viridis',\\\n",
    "\t\t\t\tedgecolor='green')\n",
    "ax.set_title('Surface plot geeks for geeks')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from mpl_toolkits import mplot3d\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "\n",
    "# function for z axis\n",
    "def f(x, y):\n",
    "\treturn np.sin(np.sqrt(x ** 2 + y ** 2))\n",
    "\n",
    "# x and y axis\n",
    "x = np.linspace(-1, 5, 10)\n",
    "y = np.linspace(-1, 5, 10)\n",
    "\n",
    "X, Y = np.meshgrid(x, y)\n",
    "Z = f(X, Y)\n",
    "\n",
    "fig = plt.figure()\n",
    "ax = plt.axes(projection ='3d')\n",
    "ax.plot_wireframe(X, Y, Z, color ='green')\n",
    "ax.set_title('wireframe geeks for geeks');\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://matplotlib.org/stable/gallery/lines_bars_and_markers/cohere.html#sphx-glr-gallery-lines-bars-and-markers-cohere-py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "# Fixing random state for reproducibility\n",
    "np.random.seed(19680801)\n",
    "\n",
    "dt = 0.01\n",
    "t = np.arange(0, 30, dt)\n",
    "nse1 = np.random.randn(len(t))                 # white noise 1\n",
    "nse2 = np.random.randn(len(t))                 # white noise 2\n",
    "\n",
    "# Two signals with a coherent part at 10 Hz and a random part\n",
    "s1 = np.sin(2 * np.pi * 10 * t) + nse1\n",
    "s2 = np.sin(2 * np.pi * 10 * t) + nse2\n",
    "\n",
    "fig, axs = plt.subplots(2, 1, layout='constrained')\n",
    "fig.set_dpi(800)\n",
    "axs[0].plot(t, s1, t, s2)\n",
    "axs[0].set_xlim(0, 2)\n",
    "axs[0].set_xlabel('Time (s)')\n",
    "axs[0].set_ylabel('s1 and s2')\n",
    "axs[0].grid(True)\n",
    "\n",
    "cxy, f = axs[1].cohere(s1, s2, 256, 1. / dt)\n",
    "axs[1].set_ylabel('Coherence')\n",
    "\n",
    "# plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sosfiltfilt: pure python function in _signaltools.py"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
